<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Lorem MoonのStory - あなたはしばらくここにいるだけですが、私の人生を変えました</title><meta name="keywords" content="Hexo, blog, Lorem Moon, github page"><meta name="author" content="Lorem Moon"><meta name="copyright" content="Lorem Moon"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="即已成过往，便随它而去吧。">
<meta property="og:type" content="website">
<meta property="og:title" content="Lorem MoonのStory">
<meta property="og:url" content="https://hello-github-ui.github.io/page/4/index.html">
<meta property="og:site_name" content="Lorem MoonのStory">
<meta property="og:description" content="即已成过往，便随它而去吧。">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg">
<meta property="article:author" content="Lorem Moon">
<meta property="article:tag" content="Hexo, blog, Lorem Moon, github page">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://hello-github-ui.github.io/page/4/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: {"appId":"D5QZVMNT9K","apiKey":"92de0b03da46fa778c95817524081160","indexName":"hexo-blog","hits":{"per_page":100},"languages":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}.","hits_stats":"${hits} results found in ${time} ms"}},
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"It has been","messageNext":"days since the last update, the content of the article may be outdated."},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: 'days',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Lorem MoonのStory',
  isPost: false,
  isHome: true,
  isHighlightShrink: true,
  isToc: false,
  postUpdate: '2022-03-08 20:35:16'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">60</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">46</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">Categories</div><div class="length-num">5</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/musics/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('https://pic.imgdb.cn/item/604b7e335aedab222ce6194d.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Lorem MoonのStory</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> Search</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/musics/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">Lorem MoonのStory</h1><div id="site_social_icons"><a class="social-icon" href="https://github.com/hello-github-ui" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:util.you.come@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left"><a href="/posts/37143/" title="SpringBoot之Logback日志文件配置"><img class="post_bg" src="https://pic.imgdb.cn/item/6123bdb444eaada739c67806.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SpringBoot之Logback日志文件配置"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/37143/" title="SpringBoot之Logback日志文件配置">SpringBoot之Logback日志文件配置</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-08-23T15:19:53.000Z" title="Created 2021-08-23 23:19:53">2021-08-23</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/SpringBoot/">SpringBoot</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/Logback/">Logback</a></span></div><div class="content">概述Logback是一个日志框架，Logback和Log4j都是开源的日志工具库，Logback是Log4j的改良版本，内置实现了slf4j，比Log4j拥有更多的特性，性能也带来很大提升。SpringBoot默认内置了Logback日志框架，Spring Boot 集成logback需要添加 spring-boot-starter-logging 依赖，而此依赖已经在 spring-boot-starter 中添加过了，所以不用再添加此依赖了(如下图) ：
Log4j建议只使用四个级别，优先级从高到低分别是 ERROR、WARN、INFO、DEBUG，优先级高的将被打印出来。（logback通用）通过定义级别，可以作为应用程序中相应级别的日志信息的开关。

比如在这里定义了INFO级别，则应用程序中所有DEBUG级别的日志信息将不被打印出来。（设置INFO级别，即：&gt;=INFO 生效*

项目上生产环境的时候一定得把debug的日志级别重新调为warn或者更高，避免产生大量日志。
配置详解默认情况下，SpringBoot会用Logback来记录日志，并用INFO级别输出到控制台 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/27009/" title="ElasticSearch学习"><img class="post_bg" src="https://pic.imgdb.cn/item/612209d34907e2d39cacb8ca.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="ElasticSearch学习"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/27009/" title="ElasticSearch学习">ElasticSearch学习</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-08-22T08:24:28.000Z" title="Created 2021-08-22 16:24:28">2021-08-22</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.570Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/ElasticSearch/">ElasticSearch</a></span></div><div class="content">数据格式Elasticsearch 是面向文档型的数据库，一条数据在这里就是一个文档。es里面的概念和关系型数据库中的概念比对如下，可以依此进行理解：

索引操作创建索引对比关系型数据库，创建索引就等同于创建数据库。
在Postman中，向ES服务器发送put请求：http://localhost:9200/shopping

查询索引查询索引用的是get请求：

如果想查询当前ES所有的index（索引），怎么查呢？需要发送如下的get请求：
http://localhost:9200/_cat/indices?v

删除索引发送DELETE请求：http://localhost:9200/shopping

文档操作创建文档索引已经创建好了，接下来我们创建文档，并添加数据。这里的文档可以类比为关系型数据库中的表数据，添加的数据格式为JSON格式。
在Postman中，向ES服务器发送POST请求：http://localhost:9200/shopping/_doc
请求体内容为：
&#123;    &quot;titile&quot;: &quot;小米手机&quot;,    ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/41684/" title="面试专题一"><img class="post_bg" src="https://pic.imgdb.cn/item/61210e2b4907e2d39c3ff679.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="面试专题一"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/41684/" title="面试专题一">面试专题一</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-06-23T07:10:20.000Z" title="Created 2021-06-23 15:10:20">2021-06-23</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a><i class="fas fa-angle-right article-meta-link"></i><a class="article-meta__categories" href="/categories/code/%E8%AE%B0%E4%BA%8B%E6%9C%AC/">记事本</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E9%9D%A2%E8%AF%95/">面试</a></span></div><div class="content">Java并发篇相关演示代码地址：guyuexuan039/interview: 面试知识点汇总 (github.com)
一、Java如何开启线程？怎么保证线程安全？
首先说一下线程和进程的区别：进程是操作系统进行资源分配的最小单元；线程是操作系统进行任务分配的最小单元。线程隶属于进程。
如何开启线程？
    1.继承 Thread类，重写run方法。
    2.实现Runnable接口，实现run方法。
    延伸到start方法和run方法的区别，调用start方法开启一个线程，而在start方法内部呢会调用run方法去实现一个线程的逻辑。而如果是我们主观地直接调用run方法，那就是一个普通的方法调用，并不会开启线程。
    3.实现Callable接口，实现 call 方法。传统的Runnable和Thread的run方法是没有返回值的，如果你想返回一下线程的执行结果，就需要通过 Callable接口来实现。通过 FutureTask创建一个线程，获取到线程执行的返回值。
    4.通过线程池来开启线程（不熟悉线程池的话就不要提这种方式）
怎么保证线程安全？
    什 ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/49125/" title="BIO-NIO-AIO"><img class="post_bg" src="https://pic.imgdb.cn/item/60d18f04844ef46bb2bcb39a.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="BIO-NIO-AIO"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/49125/" title="BIO-NIO-AIO">BIO-NIO-AIO</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-06-22T07:17:40.000Z" title="Created 2021-06-22 15:17:40">2021-06-22</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.570Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Java/">Java</a></span></div><div class="content">java共支持三种网络编程模式：BIO，NIO，AIO三种IO模式适用场景
BIO方式适用于连接数目比较小且固定的架构，这种方式对服务器资源要求比较高，并发有局限性，JDK1.4以前是唯一的选择，好处是编码实现方式简单，且也容易理解。
NIO方式适用于连接数目多且连接比较段的架构，比如聊天服务器，弹幕系统等，相比BIO编码较复杂，JDK1.4以后开始支持。
AIO方式适用于连接数据多且连接较长的场景，比如相册服务器等，编程较复杂，JDK1.7才开始支持。目前好像并为得到广泛使用。

BIO(blocking I/O) 基本介绍Java BIO是传统的Java io编程，相关的类和接口在java.io包中Java BIO：同步阻塞，一个连接为一个线程，连接一个客户端就需要启动一个线程进行处理，如果连接未断开且未做任何事，会造会不必要的开销。可以通过线程池优化。Java BIO：适用于连接数目较小且相对固定的架构，对服务器的要求比较高，对并发有局限性。JDK1.4以前唯一的选择，简单易理解。
BIO的原理示意图
流程
服务器启动ServerSoket。
客户端启动Socket与服务器通信， ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/28125/" title="合并多个有序数组"><img class="post_bg" src="https://pic.imgdb.cn/item/60d07f83844ef46bb2e35686.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="合并多个有序数组"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/28125/" title="合并多个有序数组">合并多个有序数组</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-06-21T11:52:12.000Z" title="Created 2021-06-21 19:52:12">2021-06-21</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Java/">Java</a></span></div><div class="content">public class JoinArray &#123;    public static void main(String[] args) &#123;        int[] a1 = &#123;1, 3, 5, 7, 13&#125;;        int[] a2 = &#123;2, 4, 6, 12, 14&#125;;        System.out.println(Arrays.toString(sort(a1, a2)));    &#125;    public static int[] sort(int[] a, int[] b)&#123;        int[] c = new int[a.length + b.length];        int i = 0, j = 0, k = 0;        while (i &lt; a.length &amp;&amp; j &lt; b.length)&#123;            if (a[i] &gt;= b[j])&#123;                c[k++] = b[j ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/39213/" title="Tomcat如何快速部署war包程序"><img class="post_bg" src="https://pic.imgdb.cn/item/60a283596ae4f77d357d0d2b.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Tomcat如何快速部署war包程序"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/39213/" title="Tomcat如何快速部署war包程序">Tomcat如何快速部署war包程序</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-05-17T14:54:31.000Z" title="Created 2021-05-17 22:54:31">2021-05-17</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%AE%B0%E4%BA%8B%E6%9C%AC/">记事本</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Tomcat/">Tomcat</a></span></div><div class="content">Tomcat 中如何部署war包这里我使用最快速的一种方式，即通过修改 conf/server.xml 文件来实现
&lt;Context docBase=&quot;/home/xiaohua/my-app/yaoqishan&quot; path=&quot;/&quot; debug=&quot;0&quot; reloadable=&quot;false&quot;/&gt;
在 server.xml 最下面添加如上一行代码即可成功实现将 yaoqishan.war 包部署到 tomcat 中，启动 tomcat ，访问 http://localhost:8080/ 即可访问成功。之后每次修复bug后，只需要将你的war包上传到 /home/xiaohua/my-app/yaoqishan 目录下替换掉原有的war包即可。

若是在 windows 环境下，只需要修改如上代码为：

&lt;Context docBase=&quot;E:/github-project/yaoqishan/target/yaoqishan&quot; path=&quot;/&quot; deb ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/32650/" title="Intellij IDEA 常用功能"><img class="post_bg" src="https://img.imgdb.cn/item/60786c748322e6675cb9449e.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Intellij IDEA 常用功能"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/32650/" title="Intellij IDEA 常用功能">Intellij IDEA 常用功能</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-04-27T16:07:43.000Z" title="Created 2021-04-28 00:07:43">2021-04-28</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.570Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E5%B7%A5%E5%85%B7/">工具</a></span></div><div class="content">Tab 页在 intellij idea 中，直接使用快捷键 ctrl+e 来找到最近访问过的文件；使用 ctrl+shift+e 来访问最近编辑过的文件。
跳到特定的文件夹在intellij idea 中，可以输入 /文件夹名 来跳到特定的文件夹（使用double shift快捷键）。
快速补全行末分号Java 中，每一条语句的末尾都得加上 ; 号，我们可以在行中任意位置使用快捷键 ctrl+shift+enter 来快速补全分号。
Rest Clientintellij idea 中内置了一个 rest client，可以通过 ctrl+shift+a 调出面板，然后搜索 rest client 来找到，打开以后可以看到一个简单的 rest client。之所以说它比较简单是因为觉得还是 postman 更加强大，相比之下， rest client 则要显得逊色得多。
粘贴板历史选择直接通过快捷键 ctrl+shift+v 来访问历史 粘贴板。
Language Injection大家都知道在 Java 的 String 中编辑有 JSON 的话有多麻烦，各种转义真是让人疯狂，在  ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/9274/" title="Facebook-China数据"><img class="post_bg" src="https://pic.imgdb.cn/item/61210ed64907e2d39c416c0a.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Facebook-China数据"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/9274/" title="Facebook-China数据">Facebook-China数据</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-04-10T04:35:04.000Z" title="Created 2021-04-10 12:35:04">2021-04-10</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.570Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E9%9A%8F%E7%AC%94/">随笔</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/%E6%95%B0%E6%8D%AE/">数据</a></span></div><div class="content">最近facebook被爆出数据泄露问题，其中泄露的数据中有67万的来自中国用户的数据，最关键的是竟然有他们的个人电话号码，以下只是一部分数据展示。


8618723339660:100020533532418:Ann:Liao:female:Chongqing, China:Chongqing, China::Chongqing Deron Instrument Manufacture Co. Ltd.:11/29/2018 12:00:00 AM::8618723344582:100028514810622:Miko:Benrekia:female:Sydney, Australia::::9/17/2018 12:00:00 AM::8618723345781:100026527711167:为:任:male:::::10/22/2018 12:00:00 AM::8618723352795:100010290875851:Mina:Somerhalder:female:Chongqing, China:Chongqing, China:::5/13/2018 12:00:00  ...</div></div></div><div class="recent-post-item"><div class="post_cover left"><a href="/posts/55281/" title="Spring AOP学习（二）"><img class="post_bg" src="https://pic.imgdb.cn/item/61210f024907e2d39c41cafb.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Spring AOP学习（二）"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/55281/" title="Spring AOP学习（二）">Spring AOP学习（二）</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-04-04T05:00:19.000Z" title="Created 2021-04-04 13:00:19">2021-04-04</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/code/">code</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Java/">Java</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/Spring-AOP/">Spring AOP</a><span class="article-meta-link">•</span><a class="article-meta__tags" href="/tags/AOP/">AOP</a></span></div><div class="content">前言我们通常在实际开发中有这样的需求场景：我需要在不改动原先的业务代码场景下，实现一些额外的功能，比如我计算一下执行某些代码耗时多久啊，我增加一些额外的日志输出啊，等等。。。那么我们怎么实现呢？这个时候就可以用到我们的 AOP 了。而 AOP 的切面呢，可以是某个类下面的某个方法，也可以是某个包下面的所有方法，还可以是凡是使用到某个注解的地方等，下面呢我们就让 AOP 去切凡是使用了某个注解的地方
定义注解package com.example.springaopdemo.annotation;import java.lang.annotation.ElementType;import java.lang.annotation.Retention;import java.lang.annotation.RetentionPolicy;import java.lang.annotation.Target;@Target(ElementType.METHOD)@Retention(RetentionPolicy.RUNTIME)public @interface CalculateExec ...</div></div></div><div class="recent-post-item"><div class="post_cover right"><a href="/posts/22629/" title="Redis主从哨兵配置"><img class="post_bg" src="https://pic.imgdb.cn/item/61210fda4907e2d39c439d0c.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Redis主从哨兵配置"></a></div><div class="recent-post-info"><a class="article-title" href="/posts/22629/" title="Redis主从哨兵配置">Redis主从哨兵配置</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">Created</span><time class="post-meta-date-created" datetime="2021-04-01T16:47:53.000Z" title="Created 2021-04-02 00:47:53">2021-04-02</time><span class="article-meta__separator">|</span><i class="fas fa-history"></i><span class="article-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.574Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="article-meta"><span class="article-meta-separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E8%AE%B0%E4%BA%8B%E6%9C%AC/">记事本</a></span><span class="article-meta tags"><span class="article-meta-separator">|</span><i class="fas fa-tag"></i><a class="article-meta__tags" href="/tags/Redis/">Redis</a></span></div><div class="content">
这里由于时间紧张，我就暂时先把自己配置的过程做成截图放在这里供大家使用，之后有时间我会来完善这篇文章的，非常抱歉。





</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/3/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/3/#content-inner">3</a><span class="page-number current">4</span><a class="page-number" href="/page/5/#content-inner">5</a><a class="page-number" href="/page/6/#content-inner">6</a><a class="extend next" rel="next" href="/page/5/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Lorem Moon</div><div class="author-info__description">即已成过往，便随它而去吧。</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">60</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">46</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">Categories</div><div class="length-num">5</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/hello-github-ui" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:util.you.come@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>Announcement</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/4723/" title="Redis主从搭建"><img src="https://pic.imgdb.cn/item/61210fda4907e2d39c439d0c.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Redis主从搭建"/></a><div class="content"><a class="title" href="/posts/4723/" title="Redis主从搭建">Redis主从搭建</a><time datetime="2022-03-08T12:34:42.574Z" title="Created 2022-03-08 20:34:42">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/43818/" title="Win10开启上帝模式"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Win10开启上帝模式"/></a><div class="content"><a class="title" href="/posts/43818/" title="Win10开启上帝模式">Win10开启上帝模式</a><time datetime="2022-03-08T12:24:42.000Z" title="Created 2022-03-08 20:24:42">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/55966/" title="Ubuntu修改静态IP"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Ubuntu修改静态IP"/></a><div class="content"><a class="title" href="/posts/55966/" title="Ubuntu修改静态IP">Ubuntu修改静态IP</a><time datetime="2022-03-04T16:11:25.000Z" title="Created 2022-03-05 00:11:25">2022-03-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/42154/" title="Java封装同步锁"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java封装同步锁"/></a><div class="content"><a class="title" href="/posts/42154/" title="Java封装同步锁">Java封装同步锁</a><time datetime="2022-03-02T12:50:01.000Z" title="Created 2022-03-02 20:50:01">2022-03-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/1553/" title="初识大数据(一)"><img src="https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/cover/default_bg3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="初识大数据(一)"/></a><div class="content"><a class="title" href="/posts/1553/" title="初识大数据(一)">初识大数据(一)</a><time datetime="2022-03-01T07:53:43.000Z" title="Created 2022-03-01 15:53:43">2022-03-01</time></div></div></div></div><div class="card-widget" id="card-newest-comments"><div class="item-headline"><i class="fas fa-comment-dots"></i><span>Newest Comments</span></div><div class="aside-list"><span>loading...</span></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>Categories</span>
            
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/code/"><span class="card-category-list-name">code</span><span class="card-category-list-count">35</span></a><ul class="card-category-list child"><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/code/%E8%AE%B0%E4%BA%8B%E6%9C%AC/"><span class="card-category-list-name">记事本</span><span class="card-category-list-count">2</span></a></li></ul></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E7%AC%94%E8%AE%B0/"><span class="card-category-list-name">笔记</span><span class="card-category-list-count">1</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E8%AE%B0%E4%BA%8B%E6%9C%AC/"><span class="card-category-list-name">记事本</span><span class="card-category-list-count">21</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E9%9A%8F%E7%AC%94/"><span class="card-category-list-name">随笔</span><span class="card-category-list-count">3</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>Tags</span></div><div class="card-tag-cloud"><a href="/tags/Java/" style="font-size: 1.45em; color: rgb(103, 132, 74)">Java</a><a href="/tags/CSS/" style="font-size: 1.15em; color: rgb(113, 157, 110)">CSS</a><a href="/tags/HTML/" style="font-size: 1.15em; color: rgb(156, 7, 166)">HTML</a><a href="/tags/MySQL/" style="font-size: 1.33em; color: rgb(18, 102, 115)">MySQL</a><a href="/tags/Centos7/" style="font-size: 1.15em; color: rgb(187, 111, 119)">Centos7</a><a href="/tags/Centos/" style="font-size: 1.21em; color: rgb(64, 200, 39)">Centos</a><a href="/tags/Redis/" style="font-size: 1.39em; color: rgb(27, 51, 36)">Redis</a><a href="/tags/%E5%9F%BA%E7%A1%80/" style="font-size: 1.33em; color: rgb(183, 93, 67)">基础</a><a href="/tags/%E7%AC%94%E8%AE%B0/" style="font-size: 1.15em; color: rgb(125, 78, 68)">笔记</a><a href="/tags/ElasticSearch/" style="font-size: 1.15em; color: rgb(50, 121, 127)">ElasticSearch</a><a href="/tags/%E6%95%B0%E6%8D%AE/" style="font-size: 1.15em; color: rgb(120, 11, 124)">数据</a><a href="/tags/Flink/" style="font-size: 1.15em; color: rgb(6, 199, 193)">Flink</a><a href="/tags/%E5%A4%A7%E6%95%B0%E6%8D%AE/" style="font-size: 1.15em; color: rgb(134, 169, 154)">大数据</a><a href="/tags/Git/" style="font-size: 1.21em; color: rgb(102, 140, 50)">Git</a><a href="/tags/GitHub/" style="font-size: 1.15em; color: rgb(70, 53, 165)">GitHub</a><a href="/tags/%E8%A7%86%E9%A2%91/" style="font-size: 1.15em; color: rgb(19, 140, 107)">视频</a><a href="/tags/%E5%B7%A5%E5%85%B7/" style="font-size: 1.27em; color: rgb(62, 19, 79)">工具</a><a href="/tags/Excel/" style="font-size: 1.15em; color: rgb(10, 96, 84)">Excel</a><a href="/tags/Linux/" style="font-size: 1.33em; color: rgb(45, 17, 200)">Linux</a><a href="/tags/Mint/" style="font-size: 1.15em; color: rgb(83, 41, 97)">Mint</a><a href="/tags/Socket/" style="font-size: 1.21em; color: rgb(193, 93, 181)">Socket</a><a href="/tags/%E7%BD%91%E7%BB%9C%E7%BC%96%E7%A8%8B/" style="font-size: 1.21em; color: rgb(119, 163, 65)">网络编程</a><a href="/tags/Spring-AOP/" style="font-size: 1.21em; color: rgb(8, 137, 29)">Spring AOP</a><a href="/tags/AOP/" style="font-size: 1.27em; color: rgb(22, 47, 23)">AOP</a><a href="/tags/SpringBoot/" style="font-size: 1.33em; color: rgb(113, 125, 83)">SpringBoot</a><a href="/tags/Logback/" style="font-size: 1.15em; color: rgb(163, 113, 57)">Logback</a><a href="/tags/Tomcat/" style="font-size: 1.21em; color: rgb(141, 50, 119)">Tomcat</a><a href="/tags/Ubuntu/" style="font-size: 1.21em; color: rgb(144, 165, 15)">Ubuntu</a><a href="/tags/VMWare/" style="font-size: 1.15em; color: rgb(160, 158, 187)">VMWare</a><a href="/tags/Vim/" style="font-size: 1.15em; color: rgb(21, 81, 81)">Vim</a><a href="/tags/Windows/" style="font-size: 1.15em; color: rgb(170, 54, 45)">Windows</a><a href="/tags/WSL/" style="font-size: 1.15em; color: rgb(3, 127, 152)">WSL</a><a href="/tags/Vue/" style="font-size: 1.21em; color: rgb(12, 17, 57)">Vue</a><a href="/tags/ElementUI/" style="font-size: 1.15em; color: rgb(128, 64, 185)">ElementUI</a><a href="/tags/%E7%94%9F%E6%B4%BB/" style="font-size: 1.21em; color: rgb(195, 168, 103)">生活</a><a href="/tags/Python/" style="font-size: 1.15em; color: rgb(152, 145, 48)">Python</a><a href="/tags/%E5%BC%82%E5%B8%B8/" style="font-size: 1.15em; color: rgb(68, 147, 176)">异常</a><a href="/tags/ControllerAdvice/" style="font-size: 1.15em; color: rgb(110, 160, 7)">@ControllerAdvice</a><a href="/tags/RocketMQ/" style="font-size: 1.33em; color: rgb(192, 124, 146)">RocketMQ</a><a href="/tags/Hadoop/" style="font-size: 1.15em; color: rgb(139, 139, 140)">Hadoop</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>Archives</span><a class="card-more-btn" href="/archives/" title="More">
    <i class="fas fa-angle-right"></i></a></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/03/"><span class="card-archive-list-date">March 2022</span><span class="card-archive-list-count">5</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/02/"><span class="card-archive-list-date">February 2022</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2022/01/"><span class="card-archive-list-date">January 2022</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/12/"><span class="card-archive-list-date">December 2021</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/11/"><span class="card-archive-list-date">November 2021</span><span class="card-archive-list-count">10</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/10/"><span class="card-archive-list-date">October 2021</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">September 2021</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/08/"><span class="card-archive-list-date">August 2021</span><span class="card-archive-list-count">2</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>Info</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">Article :</div><div class="item-count">60</div></div><div class="webinfo-item"><div class="item-name">Run time :</div><div class="item-count" id="runtimeshow" data-publishDate="2017-07-01T00:00:00.000Z"></div></div><div class="webinfo-item"><div class="item-name">Total Count :</div><div class="item-count">127.5k</div></div><div class="webinfo-item"><div class="item-name">UV :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">PV :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">Last Push :</div><div class="item-count" id="last-push-date" data-lastPushDate="2022-03-08T12:35:15.995Z"></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://pic.imgdb.cn/item/604b7e335aedab222ce6194d.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2017 - 2022 By Lorem Moon</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my <a target="_blank" rel="noopener" href="https://hello-blogger-ui.blogspot.com/">google blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">Algolia</span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="search-wrap"><div id="algolia-search-input"></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js"></script><script src="/js/search/algolia.js"></script><div class="js-pjax"></div><script src="https://cdn.jsdelivr.net/npm/blueimp-md5@2.17.0/js/md5.min.js"></script><script>window.addEventListener('load', () => {
  const changeContent = (content) => {
    if (content === '') return content

    content = content.replace(/<img.*?src="(.*?)"?[^\>]+>/ig, '[image]') // replace image link
    content = content.replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi, '[link]') // replace url
    content = content.replace(/<pre><code>.*?<\/pre>/gi, '[code]') // replace code
    content = content.replace(/<[^>]+>/g,"") // remove html tag

    if (content.length > 150) {
      content = content.substring(0,150) + '...'
    }
    return content
  }

  const getIcon = (icon, mail) => {
    if (icon) return icon
    let defaultIcon = '?d=monsterid'
    let iconUrl = `https://gravatar.loli.net/avatar/${md5(mail.toLowerCase()) + defaultIcon}`
    return iconUrl
  }

  const generateHtml = array => {
    let result = ''

    if (array.length) {
      for (let i = 0; i < array.length; i++) {
        result += '<div class=\'aside-list-item\'>'

        if (true) {
          const name = 'src'
          result += `<a href='${array[i].url}' class='thumbnail'><img ${name}='${array[i].avatar}' alt='${array[i].nick}'></a>`
        }

        result += `<div class='content'>
        <a class='comment' href='${array[i].url}' title='${array[i].content}'>${array[i].content}</a>
        <div class='name'><span>${array[i].nick} / </span><time datetime="${array[i].date}">${btf.diffDate(array[i].date, true)}</time></div>
        </div></div>`
      }
    } else {
      result += 'No Comment'
    }

    let $dom = document.querySelector('#card-newest-comments .aside-list')
    $dom.innerHTML= result
    window.lazyLoadInstance && window.lazyLoadInstance.update()
    window.pjax && window.pjax.refresh($dom)
  }

  const getComment = () => {
    const serverURL = 'https://mFM6i90b.api.lncldglobal.com'

    var settings = {
      "method": "GET",
      "headers": {
        "X-LC-Id": 'mFM6i90bN6KqyTH6tmC3q7dz-gzGzoHsz',
        "X-LC-Key": 'T2tsKoiKjMaB0wgtIAgSz6Ul',
        "Content-Type": "application/json"
      },
    }

    fetch(`${serverURL}/1.1/classes/Comment?limit=6&order=-createdAt`,settings)
      .then(response => response.json())
      .then(data => {
        const valineArray = data.results.map(function (e) {
          return {
            'avatar': getIcon(e.QQAvatar, e.mail),
            'content': changeContent(e.comment),
            'nick': e.nick,
            'url': e.url + '#' + e.objectId,
            'date': e.updatedAt,
          }
        })
        saveToLocal.set('valine-newest-comments', JSON.stringify(valineArray), 10/(60*24))
        generateHtml(valineArray)
      }).catch(e => {
        const $dom = document.querySelector('#card-newest-comments .aside-list')
        $dom.innerHTML= "Unable to get the data, please make sure the settings are correct."
      }) 
  }

  const newestCommentInit = () => {
    if (document.querySelector('#card-newest-comments .aside-list')) {
      const data = saveToLocal.get('valine-newest-comments')
      if (data) {
        generateHtml(JSON.parse(data))
      } else {
        getComment()
      }
    }
  }

  newestCommentInit()
  document.addEventListener('pjax:complete', newestCommentInit)
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>